<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>

    // var x = 1;
    // var y = 2;
    // var temp = x;
    // x = y;
    // y = temp;


    let x = 1;
    let y = 2;
    [x,y] = [y,x];
    console.log(x);//2
    console.log(y);//1

</script>

</body>
</html>